/*
    Copyright 2009 Barnet Wagman

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
 */

package ot.s3;

import ot.*;

/** The {@link Context} for objects stored in the an Amazon Webs Service (AWS)
 *  S3 bucket.  The context is specified by the bucket's name. The
 *  {@link OPath} of an object stored in a <tt>ContextS3</tt> is
 *  relative to the bucket name.  Eg. if the context contains an object
 *  with {@link OPath}
 *  <blockquote><tt>
 *      new OPath(new String[] { "path","to","an","object.ser" }
 * </tt></blockquote>
 * then the bucket will contain an object with named
 * <blockquote><tt>
 *      "path/to/an/object.ser"
 * </tt></blockquote>
 * (Note that S3 does not really maintain directories within buckets, although
 *  s3 object browsers such as <i>S3 Organizer</i> usually display objects in
 *  pseudo-directories.)
 *
 * @author Barnet Wagman
 */
public class ContextS3 implements Context {

    public String bucketName;

        /**
         *
         * @param bucketName a legal AWS S3 bucket name.
         */
    public ContextS3(String bucketName) {
        this.bucketName = bucketName;
    }

    public boolean equals(Object obj) {
        if( !(obj instanceof ContextS3) ) return(false);
        else return( bucketName.equals( ((ContextS3) obj).bucketName ));
    }

    public String toString() {
        return("bucketName=" + bucketName);
    }
}
